import Vue from 'vue'
import Router from 'vue-router'

import login from 'components/login/login.vue'
import news from 'components/news/news.vue'
import goods from 'components/goods/goods.vue'
import addgoods from 'components/goods/addgoods.vue'
import order from 'components/order/order.vue'
import shop from 'components/shop/shop.vue'
import find from 'components/find/find.vue'
import mine from 'components/mine/mine.vue'
import userInfo from 'components/mine/mine_info.vue'
import userColl from 'components/mine/mine_collection.vue'
import item from 'components/common/item.vue'
import goodsitem from 'components/goods/goodsitem.vue'
import orderitem from 'components/common/orderitem.vue'
import orderitem2 from 'components/common/orderitem2.vue'
import orderitem3 from 'components/common/orderitem3.vue'
import orderitem4 from 'components/common/orderitem4.vue'
import orderdetail from 'components/order/orderdetail.vue'

Vue.use(Router)

export default new Router({
  routes: [
    { path: '/', redirect: '/order' },//设置默认路由
    {
      path: '/login',
      name: 'login',
      component: login
     },
    {
      path: '/news',//资讯
      component: news,
      redirect: '/news/item/001',
      children:[
          { path: '/news/item/:id', component: item},
          { path: '/news/item1/:id', component: item},
          { path: '/news/item2/:id', component: item},
          { path: '/news/item3/:id', component: item}
      ]
    },
    {
      path: '/goods',//商品
      component: goods,
      // redirect: '/goods/item/0000',
      // children:[
      //     { path: '/goods/item/:id', component: goodsitem}
      // ]
    },
    {
      path: '/addgoods/:id',//添加商品
      component: addgoods,
    },
    {
      path: '/order',//订单
      component: order,
      redirect: '/order/item/1',
      children:[
          {path: '/order/item/:id', component: orderitem},
          {path: '/order/item2/:id', component: orderitem2},
          {path: '/order/item3/:id', component: orderitem3},
          {path: '/order/item4/:id', component: orderitem4}
      ]
    },
    {
      path: '/orderdetail/:id',//添加商品
      component: orderdetail,
    },
    {
      path: '/shop',//商铺
      component: shop
    },
    {
      path: '/find',//发现
      component: find
    },
    {
      path: '/mine',//我的
      component: mine
    },
    {
      path:'/mineinfo',//我的资料
      component: userInfo
    },
    {
      path:'/minecoll',//我的收藏
      component: userColl
    }
    
  ]
})
